package org.example.completed.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.completed.domain.Order;
import org.example.completed.domain.Product;
import org.example.completed.mapper.ProductMapper;
import org.example.completed.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @since 2025-04-02
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public void insert(Product product) {
        this.save(product);
    }

    @Override
    public int deleteById(String id) {
        return productMapper.deleteById(id);
    }

    @Override
    public int update(Product product) {
        return productMapper.updateById(product);
    }

    @Override
    public Product selectById(String id) {
        return productMapper.selectById(id);
    }

    @Override
    public List<Product> selectAll() {
        return baseMapper.selectList(null);
    }
}
